#region Copyright Vanderlande Industries B.V. 2011-2012
// Copyright (c) 2011-2012 Vanderlande Industries
// All rights reserved.
//
// @file:     MaintenanceDisplayItem.cs
// @version:  %version: 30 %
// %date_created: donderdag 19 januari 2012 13:24:54 %
//
// The copyright to the computer program(s) herein is the property of
// Vanderlande Industries. The program(s) may be used and/or copied
// only with the written permission of the owner or in accordance with
// the terms and conditions stipulated in the contract under which the
// program(s) have been supplied.
#endregion

using System.Collections.Generic;

namespace VI.Fsc.OperatorGui.Models.Fsc.Configuration
{
    /// <summary>
    /// Contains information on a maintenance item for display.
    /// </summary>
    public class CMaintenanceDisplayItem
    {
        private string markcode;
        private string shortId;
        private string longId;
        private string mode;
        private string rState;
        private string rsDetails;
        private int isOffline;

        public string Markcode
        {
            get { return markcode; }
        }

        public string ShortId
        {
            get { return shortId; }
            set { shortId = value; }
        }

        public string LongId
        {
            get { return longId; }
            set { longId = value; }
        }

        public string RState
        {
            get { return rState; }
            set { rState = value; }
        }

        public string RsDetails
        {
            get { return rsDetails; }
            set { rsDetails = value; }
        }

        public string Mode
        {
            get { return mode; }
            set { mode = value; }
        }

        public int IsOffline
        {
            get { return isOffline; }
            set { isOffline = value; }
        }

        public CMaintenanceDisplayItem(string markcode, string shortId, string longId, string rState, string rsDetails)
        {
            this.markcode = markcode;
            this.shortId = shortId;
            this.longId = longId;
            this.rState = rState;
            this.rsDetails = rsDetails;
        }

        /// <summary>
        /// Creates a dictionary and adds all values of this MaintenanceDisplayItem to it.
        /// </summary>
        /// <returns>A dictionary with all properties of this object.</returns>
        public Dictionary<string, object> ToDictionary()
        {
            Dictionary<string, object> row = new Dictionary<string, object>();

            row.Add("ShortId", ShortId);
            row.Add("LongId", LongId);
            row.Add("Markcode", Markcode);
            row.Add("Mode", Mode);
            row.Add("RState", RState);
            row.Add("RsDetails", RsDetails);

            row.Add("IsOffline", isOffline);

            //switch value of isOffline to isOnline to have both ways of viewing
            row.Add("IsOnline", (isOffline == 0 ? 1 : 0));
            // The following field enables displaying texts instead of the boolean value. The text will be translated
            // into the active language.
            row.Add("IsOnlineDisplay", (isOffline == 0 ? "Online" : "Offline"));
            
            return row;
        }
    }
}
